package com.inspur.gs.sbssdl.sbssgl.sbtz.sbtz.back.sbsssbtz.determinations;
import com.inspur.edp.cef.api.message.*;
import com.inspur.edp.bef.api.action.determination.*;
import com.inspur.edp.bef.spi.action.determination.*;
import com.inspur.edp.cef.entity.changeset.*;
import com.inspur.edp.bef.spi.action.determination.AbstractDetermination;
import com.inspur.edp.bef.api.action.determination.IDeterminationContext;
import com.inspur.edp.cef.entity.entity.IEntityData;
import com.inspur.edp.bef.api.action.determination.IBeforeRetrieveDtmContext;
import com.inspur.edp.cef.entity.entity.IValuesContainer;

public class SbssSbtzDtmBeforeSave2Determination extends AbstractB4SaveDetermination {
	public SbssSbtzDtmBeforeSave2Determination(IDeterminationContext context, IChangeDetail change) {
		super(context,change);
	}
	@Override
	public  void execute() {
		IEntityData currData = getContext().getCurrentData();
		Object value = currData.getValue("abc");
		if (value == null) {
			return;
		}
		Object abcLxmc = ((IValuesContainer) value).getValue("abc_lxmc");
		if (abcLxmc == null) {
			return;
		}
		String abc = abcLxmc.toString();
		currData.setValue("re", false); // 一保
		currData.setValue("ry", false); // 二保
		currData.setValue("gj", false); // 点检

		switch (abc){
			case "A":
				currData.setValue("gj", true);
			case "B":
				currData.setValue("re", true);
			case "C1":
			case "T":
				currData.setValue("ry", true);
			default:
				// 默认为C2
		}
	}
	private IEntityData getData() {
		return (IEntityData)super.getContext().getCurrentData();
	}
}